<?php

Class User_Model extends CI_Model {

    function login($username, $password) {
        $this->db->select('id, usuario_nome, usuario_login');
        $this->db->from('usuarios');
        $this->db->where('usuario_login', $username);
        $this->db->where('usuario_senha', MD5($password));
        $this->db->limit(1);

        $query = $this->db->get();

        if ($query->num_rows() == 1) {
            return $query->result();
        } else {
            return false;
        }
    }
    
    public function retornarAcesso($id){
        var_dump($id);
        $this->db->select('usuario_acesso');
        $this->db->from('usuarios');
        $this->db->where('id', $id);
        $query = $this->db->get();
        $data = $query->result();
        
        return $data[0];
        
     }

}

?>
